package org.jxf.gps.jt808.message;

import org.apache.log4j.Logger;

public class MsgBodyFactory {
	
	private static Logger logger = Logger.getLogger(MsgBodyFactory.class);
	
	public static MsgBody getMsgBody(int msgId){
		MsgBody body = null;
		if (msgId == 0x0200){
			logger.debug("getMsgBody 位置信息汇报");
			body = new Msg0200();
		}
		if (msgId == 0x0100){
			logger.debug("getMsgBody 终端注册");
			body = new Msg0100();
		}
		if (msgId == 0x0102){
			logger.debug("getMsgBody 终端鉴权");
			body = new Msg0102();
		}
		if (msgId == 0x0002){
			logger.debug("getMsgBody 终端心跳");
			body = new Msg0102();
		}
		return body;
	}
	
	public static MsgBodyHandle getMsgBodyHandle(int msgId){
		MsgBodyHandle bodyHandle = null;
		if (msgId == 0x0200){
			logger.debug("MsgBodyHandle 位置信息汇报");
			bodyHandle = new MsgBodyHandle0200();
		}else if ((msgId == 0x0100)){
			logger.debug("getMsgBodyHandle 终端注册");
			bodyHandle = new MsgBodyHandle0100();
		}else if ((msgId == 0x0102)){
			logger.debug("getMsgBodyHandle 终端鉴权");
			bodyHandle = new MsgBodyHandle0102();
		}else if ((msgId == 0x0002)){
			logger.debug("getMsgBodyHandle 终端心跳");
			bodyHandle = new MsgBodyHandle0002();
		}else {
			bodyHandle = new MsgBodyHandle();
		}
		return bodyHandle;
	}
}
